package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Category;
import com.itheima.reggie.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

// 分类模块
@RestController
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    // 分类列表
    @GetMapping("/category/list")
    public ResultInfo findAll() { // 1.接收请求
        // 2.调用service查询
        List<Category> categoryList = categoryService.findAll();
        // 3.返回 结果
        return ResultInfo.success(categoryList);
    }
}